<form class="form-horizontal" role="form" id="sensorForm">
    <input type="hidden" name="id">
    <input type="hidden" name="longitude">
    <input type="hidden" name="latitude">
    <div class="form-group">
        <label  class="col-sm-3 control-label">传感器名称</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="name"/>
        </div>
    </div>
    <div class="form-group">
        <label  class="col-sm-3 control-label">传感器SN</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="sensorSn" updateonlyread/>
        </div>
    </div>
    <div class="form-group">
        <label  class="col-sm-3 control-label">传感器类别</label>
        <div class="col-sm-9">
            <select type="search" class="form-control sensorTypeId" name="sensorTypeId"></select>
        </div>
    </div>
    <div class="form-group">
        <label  class="col-sm-3 control-label">基地</label>
        <div class="col-sm-9">
            <select type="search" class="form-control select2" name="hostId"></select>
        </div>
    </div>
    <div class="form-group">
        <label  class="col-sm-3 control-label">传感器安装位置</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="position"/>
        </div>
    </div>
    <div class="form-group">
        <label  class="col-sm-3 control-label">发送频率</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="frequency" updateonlyread/>
        </div>
    </div>
    <div class="form-group">
        <label  class="col-sm-3 control-label">在线状态</label>
        <div class="col-sm-9">
            <input type="text" class="form-control" name="onlineStatusString" updateonlyread/>
        </div>
    </div>
    <div class="form-group" hide>
        <label  class="col-sm-3 control-label">负责人</label>
        <div class="col-sm-9">
            <select type="search" class="form-control select2" name="createUserId" updateonlyread></select>
        </div>
    </div>
</form>

<script>
    $(function () {
        AsyncGet("${basePath}/manager/user/getUserRole",null,function (value) {
            if(value.data.role!="超级管理员"){
                $("#sensorForm [hide]").hide();
            }
        })
        loadSelectByClassSync("${basePath}/manager/sensor/getAllSensorTypeList",null,"sensorTypeId","--请选择类型--","id","name");

        $("#sensorForm [name='createUserId']").loadSelect2(
            "${basePath}/root/function/getBackgroundManagerList",
            "请输入姓名查询", 2, "username", "username");
        $("#sensorForm [name='hostId']").loadSelect2(
            "${basePath}/manager/host/getHostListByName",
            "请输入名称查询",2,"hostName","hostName");
        var interval=setInterval(function () {
            if($("#sensorForm .select2").length>0){
                $("#sensorForm .select2").width("100%");
                clearInterval(interval);
            }
        },100);

    })
</script>

